<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ page import="be.ac.ua.ecampus.uacmat.entity.*, java.util.Collection" %>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <title>Course Material
        </title>
        <link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.css" />
        <link rel="stylesheet" href="my.css" />
        <style>
            /* App custom styles */
        </style>
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js">
        </script>
        <script src="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.js">
        </script>
    </head>

<body>


<!-- Home (Search) -->
        <div data-role="page" id="home">
           <div data-theme="a" data-role="header" data-position="fixed">
                <h1>
                    Course Material
                </h1>
                <div data-role="navbar" data-iconpos="left">
                    <ul>
                        <li>
                            <a href="/uacmat20/index.jsp" data-theme="b" data-icon="search">
                                Search
                            </a>
                        </li>
                        <li>
                            <a href="/uacmat20/browse.jsp" data-theme="a" data-icon="grid">
                                Browse
                            </a>
                        </li>
                        <li>
                            <a href="/uacmat20/about.jsp" data-theme="a" data-icon="info">
                                About
                            </a>
                        </li>
                    </ul>
                </div>
            </div>
	    	<p>
			<strong><font color="#7e002f">Search: </font> <em> <%= (String) request.getAttribute("search") %> </em></strong>
    		</p>
	
		<% final Collection<Syllabus> syllabuses = (Collection<Syllabus>) request.getAttribute("syllabuses"); %>
		<% if ((syllabuses != null) && (!syllabuses.isEmpty())) { %>
			<p><strong><font color="#7e002f">Syllabuses</font></strong></p>
			<ul>
			<% for (final Syllabus result : syllabuses) { %>
	       		<li>
	        		<a href="/uacmat20/show?type=<%= result.getType() %>&id=<%= result.getId() %>"><%= result.getDescription() %></a>
	        	</li>
	    	<% }%>
	    	</ul>
 	   	<% }%>
	    
	   	<% final Collection<Course> courses = (Collection<Course>) request.getAttribute("courses"); %>
	  	<% if ((courses != null) && (!courses.isEmpty())) { %>
	   		<p><strong><font color="#7e002f">Courses</font></strong></p>
	   		<ul>
			<% for (final Course result : courses) { %>
	        	<li>
	        		<a href="/uacmat20/show?type=<%= result.getType() %>&id=<%= result.getId() %>"><%= result.getDescription() %></a>
	        	</li>
	    	<% } %>
	    	</ul>
	    <% } %>
	    
	   	<% final Collection<Program> programs = (Collection<Program>) request.getAttribute("programs"); %>
	    <% if ((programs != null) && (!programs.isEmpty())) { %>
	   		<p><strong><font color="#7e002f">Programs</font></strong></p>
	   		<ul>
			<% for (final Program result : programs) { %>
	        	<li>
	        		<a href="/uacmat20/show?type=<%= result.getType() %>&id=<%= result.getId() %>"><%= result.getDescription() %></a>
	        	</li>
	    	<% } %>
	    	</ul>
	    <% } %>
	    
	    <% final Collection<Packet> packets = (Collection<Packet>) request.getAttribute("packets"); %>
	    <% if ((packets != null) && (!packets.isEmpty())) { %>
	   		<p><strong><font color="#7e002f">Packets</font></strong></p>
	   		<ul>
			<% for (final Packet result : packets) { %>
	        	<li>
	        		<a href="/uacmat20/show?type=<%= result.getType() %>&id=<%= result.getId() %>"><%= result.getDescription() %></a>
	        	</li>
	    	<% } %>
	    	</ul>
	    <% } %>	    

	    <% if ((programs == null || programs.isEmpty()) &&  (courses == null || courses.isEmpty()) && (syllabuses == null || syllabuses.isEmpty()) && (packets == null || packets.isEmpty())) { %>
	   		<p align="center"><strong><font color="#7e002f">No Record.</font></strong></p>
	    <% } %>
	    
	    <div data-theme="a" data-role="footer" data-position="fixed">
                <h3>
                    <INPUT TYPE="BUTTON" VALUE="Go Back" ONCLICK="history.go(-1)">
                </h3>
            </div>
	    </div>
</body>
</html>